﻿#ifndef DIALOG_MANUALFOCUS_H
#define DIALOG_MANUALFOCUS_H

#include <QDialog>
#include <QMutex>
#include "showimage.h"

struct rgb24
{
    uint8_t b;
    uint8_t g;
    uint8_t r;
};

namespace Ui {
class Dialog_ManualFocus;
}

class Dialog_ManualFocus : public QDialog
{
    Q_OBJECT

public:
    explicit Dialog_ManualFocus(QWidget *parent = 0);
    ~Dialog_ManualFocus();
    int getResult();
signals:
    void moveUp();
    void moveDown();
    void stop();
    void changeSpeed(double mmps);
public slots:
    void updateImage(const uint8_t *pBuf, QSize size);
private slots:
    void on_pushButton_close_clicked();
    void on_pushButton_ok_clicked();
    void on_pushButton_moveUp_pressed();
    void on_pushButton_moveUp_released();
    void on_pushButton_moveDown_pressed();
    void on_pushButton_moveDown_released();
    void on_pushButton_stop_pressed();
    void on_verticalSlider_valueChanged(int value);

private:
    Ui::Dialog_ManualFocus *ui;
    QList<double> m_levels;
    QImage m_image;
    QMutex m_image_mutex; ///< m_image 会被多个线程访问，需用 mutex 保护
    showImage *m_showImage;
};

#endif // DIALOG_MANUALFOCUS_H
